﻿<%@ Page Title="" Language="C#" MasterPageFile="~/TP3Master.master" AutoEventWireup="true" CodeFile="frmRegistroTipoEspectaculo.aspx.cs" Inherits="Espectaculos_Configuracion_frmRegistroTipoEspectaculo" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" Runat="Server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
<table  class="tablaForm" align="center"> 
<tr>
    
    <td align="left" class="filaCab">

        <asp:Label ID="lblTituloProg" runat="server" Text="Registro de Tipos de Espectáculo" Font-Size="Larger"></asp:Label>
    </td>
</tr>
<tr>
    <td align="center">
        
        <table>
         <tr>
                <td align="center" colspan="3">
                    <asp:Label ID="lblMensaje" runat="server"></asp:Label>
                </td>
            </tr>
          
            <tr>
                <td class="columnaDesc" >Tipo de espectáculo :</td>
                <td class="columnaCtrl">  
                    <asp:TextBox ID="txtNombre" runat="server" Width="300px" MaxLength="50"></asp:TextBox>  </td>
                <td class="columnaCtrl">    
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                        ControlToValidate="txtNombre" Display="Static" 
                        ErrorMessage="Ingrese el nombre del tipo." ValidationGroup="grabar" 
                        ForeColor="Red">*</asp:RequiredFieldValidator>
                    <asp:ValidatorCalloutExtender ID="RequiredFieldValidator1_ValidatorCalloutExtender" 
                        runat="server" Enabled="True" TargetControlID="RequiredFieldValidator1">
                    </asp:ValidatorCalloutExtender>
                </td>
            </tr>
           
             <tr>
                <td class="columnaDesc" >Activo :</td>
                <td class="columnaCtrl">  
                    <asp:CheckBox ID="chkActivo" runat="server" />
                 </td>
                <td>    &nbsp;</td>
            </tr>
            <tr>
                <td align="right">Agregar Subtipo </td>
                <td class="columnaCtrl">
                <asp:ImageButton ID="imbAgregarSub" runat="server" 
                        ImageUrl="~/Espectaculos/Images/botones/add.png" ToolTip="Agregar Subtipo" 
                        onclick="imbAgregarSub_Click" />


                </td>
                <td class="columnaCtrl">&nbsp;</td>
            </tr>
            <tr>
                <td></td>
                <td class="columnaDesc">
                    <asp:Button ID="btnGrabar" runat="server" Text="Grabar" 
                        onclick="btnGrabar_Click" ValidationGroup="grabar" /></td>
                <td class="columnaCtrl"><asp:Button ID="btnCancelar" runat="server" Text="Cancelar" 
                        onclick="btnCancelar_Click" /></td>
            </tr>
            <tr>
                <td align="right">&nbsp;</td>
                <td class="columnaCtrl" >
                    &nbsp;</td>
                <td class="columnaCtrl">&nbsp;</td>
            </tr>
            <tr>
                <td align="center" colspan="3" >
                    <asp:UpdatePanel ID="upnlArt" runat="server" UpdateMode="Conditional">
                        <ContentTemplate>
                            <asp:GridView ID="grvSub" runat="server" BackColor="White" AutoGenerateColumns="False"
                                BorderColor="#CC9966" BorderStyle="None" BorderWidth="1px" CellPadding="4" OnRowDataBound="grvSubs_RowDataBound"
                                OnRowCommand="grvSubs_RowCommand" DataKeyNames="IdSubTipo">
                                <Columns>
                                     <asp:TemplateField HeaderText="Id">
                                        <ItemTemplate>
                                            <asp:Label ID="lblId" runat="server" Text='<%# Bind("IdSubTipo") %>'></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                     <asp:TemplateField HeaderText="SubTipo">
                                        <EditItemTemplate>
                                            <asp:TextBox ID="txtDescripcion" runat="server" Width="200px" Text='<%# Bind("SubTipo") %>'></asp:TextBox>
                                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Ingrese una descripción."
                                                Display="Dynamic" ControlToValidate="txtDescripcion" ValidationGroup="grabar">*</asp:RequiredFieldValidator>
                                        </EditItemTemplate>
                                        <ItemTemplate>
                                            <asp:Label ID="lblDescripcion" runat="server" Text='<%# Bind("SubTipo") %>'></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Estado">
                                        <ItemTemplate>
                                            <asp:Image ID="ibtnEstado" runat="server" />
                                            <asp:HiddenField ID="hdEstado" runat="server" Value='<%# Bind("Estado") %>' />
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                     <asp:TemplateField>
                                        <EditItemTemplate>
                                            <asp:ImageButton ID="ibtnGrabar" runat="server" ImageUrl="~/Espectaculos/Images/botones/save.gif"
                                                ToolTip="Grabar" CommandName="Grabar" ValidationGroup="grabar">
                                            </asp:ImageButton>
                                            <asp:ImageButton ID="ibtnDeshacer" runat="server" ImageUrl="~/Espectaculos/Images/botones/left.gif"
                                                CausesValidation="False" ToolTip="Deshacer" CommandName="Deshacer">
                                            </asp:ImageButton>
                                        </EditItemTemplate>
                                        <ItemTemplate>
                                            <asp:ImageButton ID="ibtnEditar" runat="server" ImageUrl="~/Espectaculos/Images/botones/fileedit.gif"
                                                ToolTip="Editar" CommandName="Editar"></asp:ImageButton>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                </Columns>
                                <FooterStyle BackColor="#FFFFCC" ForeColor="#330099" />
                                <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="#FFFFCC" />
                                <PagerStyle BackColor="#FFFFCC" ForeColor="#330099" HorizontalAlign="Center" />
                                <RowStyle BackColor="White" ForeColor="#330099" />
                                <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="#663399" />
                                <SortedAscendingCellStyle BackColor="#FEFCEB" />
                                <SortedAscendingHeaderStyle BackColor="#AF0101" />
                                <SortedDescendingCellStyle BackColor="#F6F0C0" />
                                <SortedDescendingHeaderStyle BackColor="#7E0000" />
                            </asp:GridView>
                              <asp:HiddenField ID="hdIdTipo" runat="server" Value="0" />
                        </ContentTemplate>
                        <Triggers>
                            <asp:AsyncPostBackTrigger ControlID="btnGrabar" EventName="Click" />
                            <asp:AsyncPostBackTrigger ControlID="imbAgregarSub" EventName="Click" />
                            <asp:AsyncPostBackTrigger ControlID="grvSub" EventName="RowCommand" />
                        </Triggers>
                    </asp:UpdatePanel>
                
                
                
                </td>
            </tr>
        </table>
               
    </td>
    
</tr>    
</table>
  <script language="javascript" type="text/javascript">

      function cambiarEstado(btn, hd) {
          var boton = document.getElementById(btn);
          var hidden = document.getElementById(hd);

          if (hidden.value == "1") {
              hidden.value = "0";
              boton.src = '../Images/botones/inactivo.png';
              boton.alt = "Activar";
          }
          else {
              hidden.value = "1";
              boton.src = '../Images/botones/activo.png';
              boton.alt = "Desactivar";
          }

      }
     
    </script>
</asp:Content>

